/***********************************************
* NYNO-Lights
* At  : Oct, 2007
* By  : Sean Zhang (sea.sky.heart@gmail.com)
* Home: http://www.noyesno.net/
* *** Copyriths Reserved  ***
*************************************************
* A game to turn on all the lights.
************************************************/

#ifndef __LightsWindow_hpp
#define __LightsWindow_hpp
#include <fltk/Window.h>

#include <fltk/IntInput.h>
#include <fltk/Button.h>

class LightsWindow: public fltk::Window {
    int cell_size;
    int _color_off;
    int _color_on;
    fltk::Button *light_cells[25];
    int game[25];
    static fltk::Window *win_help;
    fltk::IntInput *_game_id;
    
public:
  LightsWindow(int w, int h);

  
  static void check_cbk(fltk::Widget * widget, void* v){
      ((LightsWindow *)widget->parent())->check_game((int)v);
  }

  static void solve_cbk(fltk::Widget * widget, void*){
      ((LightsWindow *)widget->parent())->solve_game();
  }
  static void new_cbk(fltk::Widget * widget, void*){
      ((LightsWindow *)widget->parent())->new_game();
  }
  static void reset_cbk(fltk::Widget * widget, void*){
      ((LightsWindow *)widget->parent())->reset_game();
  }
  static void help_cbk(fltk::Widget * widget, void*);
  
  void drawLightsGrid();
  void switch_light(int index);
  void check_game(int index);
  void solve_game();
  void reset_game();
  void new_game();

private:
  void switch_single_light(int index);
} ;

#endif

